</div>

<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=yourpubid" async="async"></script>

<!-- Quantity Input -->
<script type="text/javascript">
$(document).ready(function () {

    $(".quantity").keydown(function (e) {
        if (e.keyCode == 8 || e.keyCode <= 46) return; // Allow: backspace, delete.
        if ((e.keyCode >= 35 && e.keyCode <= 39)) return; // Allow: home, end, left, right
        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) e.preventDefault();
    });

    $('.qtyminus').click(function () {
        if (parseInt($('.quantity').val()) > 1)
            $('.quantity').val(parseInt($('.quantity').val()) - 1);
        else
            $('.quantity').val('1');
    });

    $('.qtyplus').click(function () {
        $('.quantity').val(parseInt($('.quantity').val()) + 1);
        if ($('.quantity').val() == 'NaN') $('.quantity').val('1');
    });

    $('.buybutton').click(function () {
        if (parseInt($('.quantity').val()) < 1) $('.quantity').val('1');
    });

});
</script>

<!-- Details Tabs -->
<script type="text/javascript">
$(document).ready(function() {
		$('.nav-tabs > li > a').click(function(event){
		event.preventDefault();//stop browser to take action for clicked anchor

		//get displaying tab content jQuery selector
		var active_tab_selector = $('.nav-tabs > li.tab-active > a').attr('href');

		//find actived navigation and remove 'active' css
		var actived_nav = $('.nav-tabs > li.tab-active');
		actived_nav.removeClass('tab-active');

		//add 'active' css into clicked navigation
		$(this).parents('li').addClass('tab-active');

		//hide displaying tab content
		$(active_tab_selector).removeClass('tab-active');
		$(active_tab_selector).addClass('tab-hide');

		//show target tab content
		var target_tab_selector = $(this).attr('href');
		$(target_tab_selector).removeClass('tab-hide');
		$(target_tab_selector).addClass('tab-active');
	  });
});
</script>

<!-- Lightbox http://osvaldas.info/image-lightbox-responsive-touch-friendly -->
<script type="text/javascript" src="/DesktopModules/NBright/NBrightBuy/Themes/Cygnus/js/imagelightbox.nbb.js"></script>
<script type="text/javascript">
$(document).ready(function() {

//Integrate custom lightBox for NBS
$(function() {
    var activityIndicatorOn = function() {
        $('<div id="imagelightbox-loading"><div></div></div>').appendTo('body');
    },
			activityIndicatorOff = function() {
			    $('#imagelightbox-loading').remove();
			},

			overlayOn = function() {
			    $('<div id="imagelightbox-overlay"></div>').appendTo('body');
			},
			overlayOff = function() {
			    $('#imagelightbox-overlay').remove();
			},

			closeButtonOn = function(instance) {
			    $('<a href="#" id="imagelightbox-close">Close</a>').appendTo('body').on('click', function() { $(this).remove(); instance.quitImageLightbox(); return false; });
			},
			closeButtonOff = function() {
			    $('#imagelightbox-close').remove();
			},

			captionOn = function() {
			    var description = $('a[[href="' + $('#imagelightbox').attr('src') + '"]] img').attr('alt');
			    if (description.length > 0)
			        $('<div id="imagelightbox-caption">' + description + '</div>').appendTo('body');
			},
			captionOff = function() {
			    $('#imagelightbox-caption').remove();
			},

			navigationOn = function(instance, selector) {
			    var images = $(selector);
			    if (images.length) {
			        var nav = $('<div id="imagelightbox-nav"></div>');
			        for (var i = 0; i < images.length; i++)
			            nav.append('<a href="#"></a>');

			        nav.appendTo('body');
			        nav.on('click touchend', function() { return false; });

			        var navItems = nav.find('a');
			        navItems.on('click touchend', function() {
			            var $this = $(this);
			            if (images.eq($this.index()).attr('href') != $('#imagelightbox').attr('src'))
			                instance.switchImageLightbox($this.index());

			            navItems.removeClass('active');
			            navItems.eq($this.index()).addClass('active');

			            return false;
			        })
					.on('touchend', function() { return false; });
			    }
			},
			navigationUpdate = function(selector) {
			    var items = $('#imagelightbox-nav a');
			    items.removeClass('active');
			    items.eq($(selector).filter('[href="' + $('#imagelightbox').attr('src') + '"]').index(selector)).addClass('active');
			},
			navigationOff = function() {
			    $('#imagelightbox-nav').remove();
			};
			
					//	Custom configuration for NBrightBuy
		var instanceNBB = $('a[[data-imagelightbox="nbb"]]').imageLightbox(
		{
			animationSpeed: [Settings:lightboxspeed],
		    onStart: function() { overlayOn(); closeButtonOn(instanceNBB); },
		    onEnd: function() { overlayOff(); captionOff(); closeButtonOff(); activityIndicatorOff(); },
		    onLoadStart: function() { captionOff(); activityIndicatorOff(); },
		    onLoadEnd: function() { captionOn(); activityIndicatorOff(); }
		});
});
});

</script>

<!-- Masonry Grid http://masonry.desandro.com -->
<script type="text/javascript">
$( document ).ready(function() {

var $container = $('#relatedwrapper').masonry({
  columnWidth: [Settings:classicrelateditemwidth], // List item width - Can also use CSS width of first list item
  itemSelector: '.product',
  gutter: [Settings:classicrelateditemgutter], // Set horizontal gap and include in calculations. Also used in CSS for vertical gap
  isOriginLeft: true, // Build from right to left if false
  isOriginTop: true, // Build from bottom to top if false
});

});
</script>